home *** CD-ROM | disk | FTP | other *** search
- ICONS
- -------------------------------------------------------------------
-
- Icons are a special kind of image that are drawn as they are used, they
- are not stored as bit images.
-
- Icons are created with the ICON Editor. The ICON editor is included
- with the TEGL Windows Toolkit but is not included with the Intro Paks.
-
- void putpict(unsigned x, unsigned y, char *icon, unsigned color);
-
- putpict is the routine that draws an icon. The x,y parameters are the
- screen location to draw at. Icon points to a valid icon image, there
- is no checking done to see if the icon is a correct image. Color is
- the color that BLACK in the icon will be replaced with.
-
- putpict is NOT viewport relative and is never clipped.
-
-
- These are all the icons in teglicon.tpu and moreicon.tpu. Note that
- the actual name to refer to an icon is image<iconname>.
-
- ARROWDN ARROWLF ARROWRT ARROWUP
- BAR BELL BELL2 BLANKBUT
- BULB C CANCEL CHK7X6
- CHK8X10 CHK8X12 CHK8X8 CLOCK
- COMPUTER CORNER CORNER2 CORNER3
- CREDITS DISK DISK35 DISKDRV
- DOCUMENT DOWN DRAWER FILE
- FIND KEYBOARD KEYBRD2 LAST
- LBUT LEFT MBUT MC
- MONITOR MOUSE MOUSE2 MUSIC
- MUSIC2 NEXT NOTE NOTE2
- OK PREV PRINTER QUESTN2
- R RBUT READ RESIZE
- RIGHT SLIDER SLIDER2 STOPSIGN
- SUBMENU SYSTEM TIGER TINYTEGL
- TRASH UP VS WFDN
- WFUP WFICON WFLF WFRT
- WFUD WFBAR WRITE WFMDN
-
-
-
- This example simply create a frame a sticks an icon on it.
- Note that we use the x and y coordiates from the imagestkptr
- to place the iconimage.
-
-
- BEGINFILE> icon1.c
- /* -- icon1.pas */
-
- #include "teglsys.h"
-
-
- imagestkptr ifs;
-
-
- void main(void)
- {
- unsigned x1 = 100;
- unsigned y1 = 100;
- unsigned x2 = 110;
- unsigned y2 = 100;
-
- easytegl();
- easyout();
- quickframe(&ifs,&x1,&y1,&x2,&y2);
-
- /* -- use the frames x and y fields to draw the icon */
- /* -- in a relative position */
-
- putpict(ifs->x + 10,ifs->y + 10,imageSYSTEM,BLACK);
-
-
- teglsupervisor();
- }
-
-
-
- ENDFILE>
-
- void pictsize(unsigned *width, unsigned *height, char *icon);
-
- This function returns the size of an icon in pixels. Icon is the
- icon that we are interrogating. width and height return the
- respective x and y dimentions of the icon.
-
-
- This next example shows a routine that draws an icon relative to
- a frame and won't write outside the frame boundaries.
-
- BEGINFILE> icon2.c
- /* -- icon2.pas */
-
- #include "teglsys.h"
-
- /* -- draw an icon image relative to a frame, do not draw it if */
- /* -- it writes outside the frame */
-
-
- void putpictrel(imagestkptr ifs, unsigned x, unsigned y,
- void *icon, unsigned color)
- { unsigned dx, dy;
- unsigned fmaxx, fmaxy;
-
- pictsize(&dx,&dy,icon);
- fmaxx = ifs->x1 - ifs->x + 1;
- fmaxy = ifs->y1 - ifs->y + 1;
- /* -- check to see the icon will fit */
- if (((x + dx) > fmaxx) || ((y + dy) > fmaxy)) return;
- putpict(ifs->x + x,ifs->y + y,icon,color);
- }
-
- imagestkptr ifs;
-
- void main(void)
- {
- unsigned x1 = 100;
- unsigned y1 = 100;
- unsigned x2 = 110;
- unsigned y2 = 100;
-
-
- easytegl();
- easyout();
- quickframe(&ifs,&x1,&y1,&x2,&y2);
-
- /* -- use the frames x and y fields to draw the icon */
- /* -- in a relative position */
-
- putpictrel(ifs,10,10,imageSYSTEM,BLACK);
-
-
- teglsupervisor();
- }
-
-
-
- ENDFILE>
-
- ----------------------------------------------------------------------
- END ICONS
-